using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.ExpressApp.DC;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Xpo;
using DevExpress.Persistent.Validation;
namespace Ascent.QiPei.Module.BusinessObjects.Sales
{
  [DefaultClassOptions]
  [DevExpress.Persistent.Base.NavigationItemAttribute("销售管理")]
  [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("客户退货")]
  public partial class CustomerReturn : DevExpress.Persistent.BaseImpl.BaseObject
  {
    private System.String _remark;
    private System.DateTime _returnsDate;
    private System.String _sONumber;
    private Ascent.QiPei.Module.BusinessObjects.Base.Customer _customer;
    private System.String _cRDCode;
    public CustomerReturn(DevExpress.Xpo.Session session)
      : base(session)
    {
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("单号")]
    [RuleRequiredField(DefaultContexts.Save)]
    public System.String CRDCode
    {
      get
      {
        return _cRDCode;
      }
      set
      {
        SetPropertyValue("CRDCode", ref _cRDCode, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("客户")]
    public Ascent.QiPei.Module.BusinessObjects.Base.Customer Customer
    {
      get
      {
        return _customer;
      }
      set
      {
          SetPropertyValue("Customer", ref _customer, value);
        //if (_customer == value)
        //  return;
        //Ascent.QiPei.Module.BusinessObjects.Base.Customer prevCustomer = _customer;
        //_customer = value;
        //if (IsLoading)
        //  return;
        //if (prevCustomer != null && prevCustomer.CustomerReturn == this)
        //  prevCustomer.CustomerReturn = null;
        //if (_customer != null)
        //  _customer.CustomerReturn = this;
        //OnChanged("Customer");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("销售单编号")]
    [DevExpress.Persistent.Base.DataSourcePropertyAttribute("Customer.SOCode")]
    public System.String SONumber
    {
      get
      {
        return _sONumber;
      }
      set
      {
        SetPropertyValue("SONumber", ref _sONumber, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("备注")]
    public System.String Remark
    {
      get
      {
        return _remark;
      }
      set
      {
        SetPropertyValue("Remark", ref _remark, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("退货日期")]
    [RuleRequiredField(DefaultContexts.Save)]
    public System.DateTime ReturnsDate
    {
      get
      {
        return _returnsDate;
      }
      set
      {
        SetPropertyValue("ReturnsDate", ref _returnsDate, value);
      }
    }
    [DevExpress.Xpo.AssociationAttribute("CustomerReturnItems-CustomerReturn")]
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("明细")]
    public XPCollection<Ascent.QiPei.Module.BusinessObjects.Sales.CustomerReturnItems> CustomerReturnItems
    {
      get
      {
        return GetCollection<Ascent.QiPei.Module.BusinessObjects.Sales.CustomerReturnItems>("CustomerReturnItems");
      }
    }
  }
}
